package com.sskj.hhrt.transaction;

import com.sskj.hhrt.BasePresenter;
import com.sskj.hhrt.api.ApiObserver;
import com.sskj.base.utils.RxUtils;
import com.sskj.hhrt.api.Api;
import com.sskj.hhrt.transaction.data.OrderHistoryBean;


/**
 * @author Hey
 * Create at  2019/03/21
 */
class HistoryEntrustPresenter extends BasePresenter<HistoryEntrustActivity> {
    public void getHistoryDeal(String account, int page, int pageSize, String startTime, String endTime) {
        Api.getInstance().historyEntrust("dealInfo", account, startTime, endTime,  page, pageSize)
                .compose(RxUtils.transform())
                .subscribe(new ApiObserver<OrderHistoryBean>(this, true) {
                    @Override
                    public void onSuccess(OrderHistoryBean data) {
                        mView.setData(data);
                    }

                    @Override
                    public void onError(Throwable e) {
                        super.onError(e);
                        mView.setData(null);
                    }

                    @Override
                    public void onComplete() {
                        super.onComplete();
                        mView.finishRefresh();
                    }
                });
    }
}
